/**
 * Created by Administrator on 2017/4/1.
 */
"use strict";
swan_pc
    .controller("OrgOppDecisionController",function($scope,$rootScope,$state,oppDecision) {

        $scope.getDecision=function () {
            oppDecision.query({id:$rootScope.opp.id},function (result) {
                $scope.decision=result;
                console.log('DECISION:',$scope.decision);
            })
        };

        $scope.getAllList=function () {
            $scope.roleList=[
                {
                    name:'决策人',
                    value:1
                },
                {
                    name:'评估人',
                    value:2
                },
                {
                    name:'建议者',
                    value:3
                },
                {
                    name:'使用者',
                    value:4
                },
                {
                    name:'管理层',
                    value:5
                },
            ];
            $scope.secondRoleList=[
                {
                    name:'领导评估人',
                    value:1
                },
                {
                    name:'专业评估人',
                    value:2
                },
                {
                    name:'普通评估人',
                    value:3
                }
            ];
            $scope.supportList=[
                {
                    name:'人际关系',
                    value:1
                },
                {
                    name:'性价比',
                    value:2
                },
                {
                    name:'上级影响',
                    value:3
                },
                {
                    name:'技术观点',
                    value:4
                },
                {
                    name:'产品',
                    value:5
                },
                {
                    name:'价格',
                    value:6
                },
                {
                    name:'历史原因',
                    value:7
                },
            ];
            $scope.understandList=[
                {
                    name:'了解',
                    value:1
                },
                {
                    name:'部分了解',
                    value:2
                },
                {
                    name:'不了解',
                    value:3
                }
            ];
            $scope.seeTimeList=[
                {
                    name:'见过一次',
                    value:1
                },
                {
                    name:'见过数次',
                    value:2
                },
                {
                    name:'没有见过',
                    value:3
                }
            ];
            $scope.knowMethodList=[
                {
                    name:'别人介绍',
                    value:1
                },
                {
                    name:'通过活动',
                    value:2
                },
                {
                    name:'Cold Call',
                    value:3
                },
                {
                    name:'主动认识',
                    value:4
                },
                {
                    name:'通过圈子',
                    value:5
                },
                {
                    name:'找上门来',
                    value:6
                }
            ];
            $scope.ourReliableList=[
                {
                    name:'可靠',
                    value:1
                },
                {
                    name:'相对可靠',
                    value:2
                },
                {
                    name:'油滑',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
            $scope.opinionList=[
                {
                    name:'好',
                    value:1
                },
                {
                    name:'不好',
                    value:2
                },
                {
                    name:'凑合',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
            $scope.victoryList=[
                {
                    name:'希望',
                    value:1
                },
                {
                    name:'无所谓',
                    value:2
                },
                {
                    name:'反对',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
            $scope.planList=[
                {
                    name:'很有价值',
                    value:1
                },
                {
                    name:'有价值',
                    value:2
                },
                {
                    name:'可以参考',
                    value:3
                },
                {
                    name:'无价值',
                    value:4
                },
                {
                    name:'我不清楚',
                    value:5
                },
            ];
            $scope.InfluenceList=[
                {
                    name:'大',
                    value:1
                },
                {
                    name:'一般',
                    value:2
                },
                {
                    name:'微弱',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
            $scope.desireList=[
                {
                    name:'升官',
                    value:1
                },
                {
                    name:'发财',
                    value:2
                },
                {
                    name:'出名',
                    value:4
                },
                {
                    name:'奉献',
                    value:8
                },
                {
                    name:'责任',
                    value:16
                },
                {
                    name:'爱好',
                    value:32
                },
                {
                    name:'其他',
                    value:64
                },
                {
                    name:'我不清楚',
                    value:128
                },
            ];
            $scope.seniorList=[
                {
                    name:'资深',
                    value:1
                },
                {
                    name:'相对资深',
                    value:2
                },
                {
                    name:'嫩',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
            $scope.ourReliable=[
                {
                    name:'可靠',
                    value:1
                },
                {
                    name:'相对可靠',
                    value:2
                },
                {
                    name:'油滑',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
            $scope.timelyList=[
                {
                    name:'是的',
                    value:1
                },
                {
                    name:'凑合',
                    value:2
                },
                {
                    name:'不太及时',
                    value:3
                },
                {
                    name:'我不清楚',
                    value:4
                },
            ];
        };

        $scope.getDecision();
        $scope.getAllList();

        $scope.selectDecision=function (decision) {
            $scope.show=true;
            $scope.selectDicesion=decision;
            $scope.decisionPointer={
                base:decision.makerBaseInfo,
                connect:decision.makerConnectionInfo,
                whoIntroduce:decision.makerBaseInfo.whoIntroduce.baseInfo
            };
            $scope.setStruct();
        };

        $scope.setStruct=function () {
            $scope.decisionStruct=[
                {
                    blockName: '基本信息',
                    blockKey: 'base',
                    type: 'normal',
                    list: [],
                    struct: [
                        {
                            name:'角色',
                            key:'role',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.roleList,
                            numInRow: 2,
                        },
                        {
                            name:'副角色',
                            key:'secondRole',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.secondRoleList,
                            numInRow: 2,
                        },
                        {
                            name:'是评标小组成员',
                            key:'isEvaluation',
                            type: 5,
                            preText: '',
                            afterText: '',
                            select: [],
                            numInRow: 2,
                        },
                        {
                            name:'是意见领袖',
                            key:'isLeader',
                            type: 5,
                            preText: '',
                            afterText: '',
                            select: [],
                            numInRow: 2,
                        },
                        {
                            name:'内部同盟',
                            key:'isInternal',
                            type: 5,
                            preText: '',
                            afterText: '',
                            select: [],
                            numInRow: 2,
                        },
                        {
                            name:'支持我们的理由',
                            key:'supportReason',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.supportList,
                            numInRow: 2,
                        },
                        {
                            name:'不支持我们的理由',
                            key:'notSupportReason',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.supportList,
                            numInRow: 2,
                        },
                        {
                            name:'对此人了解程度',
                            key:'understand',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.understandList,
                            numInRow: 2,
                        },
                        {
                            name:'见过此人次数',
                            key:'seeTime',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.seeTimeList,
                            numInRow: 2,
                        },
                        {
                            name:'认识此人的方式',
                            key:'knowMethod',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.knowMethodList,
                            numInRow: 2,
                        },
                        {
                            name: '谁介绍我们认识此人',
                            key: 'whoIntroduce',
                            type: 8,
                            preText: '',
                            afterText: '',
                            select: [],
                            numInRow: 2,
                        }
                    ]
                },
                {
                    blockName: '双方关系',
                    blockKey: 'connect',
                    type: 'normal',
                    list: [],
                    struct: [
                        {
                            name:'认为我方可靠',
                            key:'ourReliable',
                            type: 2,
                            preText: '',
                            afterText: '',
                            select:$scope.ourReliableList,
                            numInRow: 2,
                        },
                        {
                            name:'此人对我方看法',
                            key:'opinion',
                            type:2,
                            preText:'',
                            afterText:'',
                            select:$scope.opinionList,
                            numInRow:2,
                        },
                        {
                            name:'此人希望我方获胜',
                            key:'victory',
                            type:2,
                            preText:'',
                            afterText:'',
                            select:$scope.victoryList,
                            numInRow:2,
                        },
                        {
                            name:'此人觉得我方方案',
                            key:'plan',
                            type:2,
                            preText:'',
                            afterText:'',
                            select:$scope.planList,
                            numInRow:2,
                        },
                        {
                            name:'此人对决定的影响力',
                            key:'influence',
                            type:1,
                            preText:'',
                            afterText:'',
                            select:$scope.InfluenceList,
                            numInRow:2,
                        },
                        {
                            name:'此人的意愿',
                            key:'desire',
                            type:3,
                            preText:'',
                            afterText:'',
                            select:$scope.desireList,
                            numInRow:2,
                        },
                        {
                            name:'此人资深程度',
                            key:'senior',
                            type:2,
                            preText:'',
                            afterText:'',
                            select:$scope.seniorList,
                            numInRow:2,
                        },
                        {
                            name:'此人可靠程度',
                            key:'reliable',
                            type:2,
                            preText:'',
                            afterText:'',
                            select:$scope.ourReliable,
                            numInRow:2,
                        },
                        {
                            name:'能给我发有价值信息',
                            key:'information',
                            type:5,
                            preText:'',
                            afterText:'',
                            select:[],
                            numInRow:2,
                        },
                        {
                            name:'信息是及时的',
                            key:'timely',
                            type:2,
                            preText:'',
                            afterText:'',
                            select:$scope.timelyList,
                            numInRow:2,
                        }
                    ]
                }
            ]
        }
    })